Skip to content

fix: render ADF document custom fields as plain text#407

Open
tio-foosy wants to merge 4 commits into
open-cli-collective:mainfrom
tio-foosy:fix/adf-customfield-read
Open

fix: render ADF document custom fields as plain text#407
tio-foosy wants to merge 4 commits into
open-cli-collective:mainfrom
tio-foosy:fix/adf-customfield-read

Conversation

@tio-foosy

@tio-foosy tio-foosy commented May 31, 2026

Copy link
Copy Markdown

Problem

jtk issues get --fields "Changelog Entry" (and any ADF-backed custom field) displays - instead of the actual content.

Root cause: In FormatCustomFieldValue, the map[string]any case only looks for keys value, name, displayName. ADF documents have type: "doc" and none of those — so they fall through to return "", which becomes "-"" via OrDash`.

This is the read side of ADF handling — #191 addressed the write path (auto-wrapping plaintext into ADF on update), but reading stored ADF values was still broken.

Fix

Detect ADF documents (maps with type: "doc") in the map[string]any case, marshal+unmarshal into ADFDocument, and call the existing ToPlainText() method.

Changes

  • tools/jtk/api/issues.go: Add ADF detection in FormatCustomFieldValue (7 lines)
  • tools/jtk/api/issues_extract_test.go: Add adf_document test case

Testing

  • All existing tests pass
  • New ADF test case: map[string]any{"type":"doc",...}"Hello ADF\n"
  • Verified against real Jira Cloud instance: jtk issues get TIO-270 --fields "Changelog Entry" now shows the actual text

FormatCustomFieldValue's map[string]any case did not detect Atlassian
Document Format objects (type: 'doc'), causing ADF-backed custom fields
(e.g. textarea, paragraph-rich) to render as '-' in 'issues get'.

Add ADF detection: when the map has type='doc', marshal+unmarshal into
ADFDocument and call ToPlainText() to extract readable text.

Fixes reading of fields like 'Changelog Entry' that use ADF storage.
@piekstra piekstra requested a review from piekstra-dev June 17, 2026 12:39
@piekstra-dev

Copy link
Copy Markdown

Automated PR Review

Reviewed commit: 3926442c0e19
Profile: reviewer - Posting as: piekstra-dev

Summary

Reviewer Findings
go:implementation-tests 0

0 PR discussion threads considered. 0 summarized; 0 resolved.


Completed in 1m 09s | ~$0.12 (est.) | claude-sonnet-4-6 | cr 0.4.161
Field Value
Model claude-sonnet-4-6
Reviewers go:implementation-tests
Engine claude_cli · claude-sonnet-4-6
Reviewed by cr · piekstra-dev
Duration 1m 09s wall · 1m 07s compute
Cost ~$0.12 (est.)
Tokens 10 in / 1.1k out

Per-workstream usage

Workstream Model In Out Cache read Cache create Cost Duration
orchestrator-selection claude-sonnet-4-6 4 809 7.2k 12.3k ~$0.06 (est.) 20s
go:implementation-tests claude-sonnet-4-6 3 123 3.3k 4.8k ~$0.02 (est.) 35s
orchestrator-rollup claude-sonnet-4-6 3 122 3.9k 8.4k ~$0.03 (est.) 11s

@piekstra-dev piekstra-dev left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated PR review completed with outcome: approved.

Add extension.Linkify to both mdParser and wikiParser so that
bare URLs (e.g. https://example.com) in --description and --body
text are automatically converted to clickable ADF hyperlinks.
When --description is used, the current issue is fetched first. Any
mediaSingle/mediaGroup nodes (images, attachments) in the existing
description are preserved and appended after the new markdown content.
This prevents accidental deletion of embedded images when replacing
text in a description.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants